
package com.google.earth.kml;

import java.util.ArrayList;
import java.util.List;

/** 
 * Schema fragment(s) for this class:
 * <pre>
 * &lt;xs:complexType xmlns:ns="http://earth.google.com/kml/2.1" xmlns:xs="http://www.w3.org/2001/XMLSchema" name="ChangeType">
 *   &lt;xs:choice maxOccurs="unbounded">
 *     &lt;!-- Reference to inner class Choice -->
 *   &lt;/xs:choice>
 * &lt;/xs:complexType>
 * </pre>
 */
public class ChangeType
{
    private List<Choice> choiceList = new ArrayList<Choice>();

    /** 
     * Get the list of 'ChangeType' complexType items.
     * 
     * @return list
     */
    public List<Choice> getChoiceList() {
        return choiceList;
    }

    /** 
     * Set the list of 'ChangeType' complexType items.
     * 
     * @param list
     */
    public void setChoiceList(List<Choice> list) {
        choiceList = list;
    }
    /** 
     * 
            <![CDATA[

              Any element ultimately derived from Object.

            ]]>
          
     * 
     * Schema fragment(s) for this class:
     * <pre>
     * &lt;xs:choice xmlns:ns="http://earth.google.com/kml/2.1" xmlns:xs="http://www.w3.org/2001/XMLSchema" maxOccurs="unbounded">
     *   &lt;xs:element ref="ns:Object" minOccurs="0"/>
     *   &lt;xs:element ref="ns:Feature" minOccurs="0"/>
     *   &lt;xs:element ref="ns:Geometry" minOccurs="0"/>
     *   &lt;xs:element ref="ns:StyleSelector" minOccurs="0"/>
     *   &lt;xs:element ref="ns:TimePrimitive" minOccurs="0"/>
     * &lt;/xs:choice>
     * </pre>
     */
    public static class Choice
    {
        private int choiceListSelect = -1;
        private static final int OBJECT_CHOICE = 0;
        private static final int FEATURE_CHOICE = 1;
        private static final int GEOMETRY_CHOICE = 2;
        private static final int STYLE_SELECTOR_CHOICE = 3;
        private static final int TIME_PRIMITIVE_CHOICE = 4;
        private ObjectType object;
        private FeatureType feature;
        private GeometryType geometry;
        private StyleSelectorType styleSelector;
        private TimePrimitiveType timePrimitive;

        private void setChoiceListSelect(int choice) {
            if (choiceListSelect == -1) {
                choiceListSelect = choice;
            } else if (choiceListSelect != choice) {
                throw new IllegalStateException(
                        "Need to call clearChoiceListSelect() before changing existing choice");
            }
        }

        /** 
         * Clear the choice selection.
         */
        public void clearChoiceListSelect() {
            choiceListSelect = -1;
        }

        /** 
         * Check if Object is current selection for choice.
         * 
         * @return <code>true</code> if selection, <code>false</code> if not
         */
        public boolean ifObject() {
            return choiceListSelect == OBJECT_CHOICE;
        }

        /** 
         * Get the 'Object' element value.
         * 
         * @return value
         */
        public ObjectType getObject() {
            return object;
        }

        /** 
         * Set the 'Object' element value.
         * 
         * @param object
         */
        public void setObject(ObjectType object) {
            setChoiceListSelect(OBJECT_CHOICE);
            this.object = object;
        }

        /** 
         * Check if Feature is current selection for choice.
         * 
         * @return <code>true</code> if selection, <code>false</code> if not
         */
        public boolean ifFeature() {
            return choiceListSelect == FEATURE_CHOICE;
        }

        /** 
         * Get the 'Feature' element value.
         * 
         * @return value
         */
        public FeatureType getFeature() {
            return feature;
        }

        /** 
         * Set the 'Feature' element value.
         * 
         * @param feature
         */
        public void setFeature(FeatureType feature) {
            setChoiceListSelect(FEATURE_CHOICE);
            this.feature = feature;
        }

        /** 
         * Check if Geometry is current selection for choice.
         * 
         * @return <code>true</code> if selection, <code>false</code> if not
         */
        public boolean ifGeometry() {
            return choiceListSelect == GEOMETRY_CHOICE;
        }

        /** 
         * Get the 'Geometry' element value.
         * 
         * @return value
         */
        public GeometryType getGeometry() {
            return geometry;
        }

        /** 
         * Set the 'Geometry' element value.
         * 
         * @param geometry
         */
        public void setGeometry(GeometryType geometry) {
            setChoiceListSelect(GEOMETRY_CHOICE);
            this.geometry = geometry;
        }

        /** 
         * Check if StyleSelector is current selection for choice.
         * 
         * @return <code>true</code> if selection, <code>false</code> if not
         */
        public boolean ifStyleSelector() {
            return choiceListSelect == STYLE_SELECTOR_CHOICE;
        }

        /** 
         * Get the 'StyleSelector' element value.
         * 
         * @return value
         */
        public StyleSelectorType getStyleSelector() {
            return styleSelector;
        }

        /** 
         * Set the 'StyleSelector' element value.
         * 
         * @param styleSelector
         */
        public void setStyleSelector(StyleSelectorType styleSelector) {
            setChoiceListSelect(STYLE_SELECTOR_CHOICE);
            this.styleSelector = styleSelector;
        }

        /** 
         * Check if TimePrimitive is current selection for choice.
         * 
         * @return <code>true</code> if selection, <code>false</code> if not
         */
        public boolean ifTimePrimitive() {
            return choiceListSelect == TIME_PRIMITIVE_CHOICE;
        }

        /** 
         * Get the 'TimePrimitive' element value.
         * 
         * @return value
         */
        public TimePrimitiveType getTimePrimitive() {
            return timePrimitive;
        }

        /** 
         * Set the 'TimePrimitive' element value.
         * 
         * @param timePrimitive
         */
        public void setTimePrimitive(TimePrimitiveType timePrimitive) {
            setChoiceListSelect(TIME_PRIMITIVE_CHOICE);
            this.timePrimitive = timePrimitive;
        }
    }
}
